<?php

namespace plugin\admin\app\model;

use plugin\admin\app\model\Base;
use plugin\admin\app\model\traits\Listable;

/**
 * @property integer $id (主键)
 * @property string $path 路径地址
 * @property string $params 参数
 * @property string $desc 链接名称
 */
class Page extends Base
{

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_pages';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';
    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    public static function list()
    {
        $data = self::all()->toArray();

        $newData = [];

        foreach ($data as $key=>$value) {
            $newData[] = ['name' => $value['desc'], 'value' => $value['path'], 'params' => $value['params']];
        }

        return $newData;
    }

    
    
}
